#ifndef MESSAGECONTENTLABEL_H
#define MESSAGECONTENTLABEL_H

#include <QWidget>
#include "model/data.h"
#include <QLabel>
#include <QFontMetrics>
#include "debug.h"
#include <QPainter>
#include <QColor>
#include <QPainterPath>
#include <QMouseEvent>
#include "toast.h"
#include <QFileDialog>
#include "soundrecorder.h"
#include <QContextMenuEvent>
#include <QMenu>
#include <QAction>


class MessageContentLabel : public QWidget
{
    Q_OBJECT
public:
    MessageContentLabel(model::MessageType type, const QString& text, const QString& fileId, const QByteArray& content, bool isLeft);
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent* event);
    void updateUI(const QString& fileId, const QByteArray& content);
    void saveAsFile(const QByteArray& content);
    void soundPlayDone();
    void contextMenuEvent(QContextMenuEvent *event);
    void speechConvertTextDone(const QString& fileId, const QString& text);
private:
    QLabel* label;
    bool isLeft;

    //标识文本/文件/语音类型
    model::MessageType messageType;
    QString fileId;
    QString fileName; //可以通过text获取
    QByteArray content;
    bool loadContentDone = false;


signals:
};

#endif // MESSAGECONTENTLABEL_H
